﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GetPageFTradeSaleTypeConfigAdd_置换.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.FTradeModel.GetPageFTradeSaleTypeConfigAdd_置换" %>
<%--置换, 置换加分期--%>

<%if (XiaoShouLeiXing == "置换加分期"){%>
<p>
    <label>1.置换金额：</label>
    <input name="Page_JinE" class="required inputFloat" type="text" value="0" size="" alt="" />
    <span class="unit">元</span>
</p>
<p>
    <label>到期日：</label>
    <input id="GetPageFTradeSaleTypeConfigAdd_PageConfig_DaoQiRi" name="Page_DaoQiRi" class="required date" type="text" value="" size="" alt="" />
</p>
<input type="hidden" name="Page_ShowIndex" value="0" />
<input type="hidden" name="Page_TongJiName" value="置换分期" />
<input type="hidden" name="Page_ShowTitle" value="置换金额" />
<input type="hidden" name="Page_SuspendedMark" value="0" />
<div class="divider"></div>

<p>
    <label>1.其余款项：</label>
    <input name="Page_JinE" class="required inputFloat" type="text" value="0" size="" alt="" />
    <span class="unit">元</span>
</p>
<p>
    <label>到期日：</label>
    <input  name="Page_DaoQiRi" class="date" type="text" value="" size="" alt="" />
</p>
<input type="hidden" name="Page_ShowIndex" value="1" />
<input type="hidden" name="Page_TongJiName" value="置换分期" />
<input type="hidden" name="Page_ShowTitle" value="其余款项" />
<input type="hidden" name="Page_SuspendedMark" value="0" />
<div class="divider"></div>



<p>
    <label>2.期数：</label>
    <input id="GetPageFTradeSaleTypeConfigAdd_PageConfig_QiShu" name="PageConfig_QiShu" class="required inputFloat" type="text" value="0" size="" alt="" />
    <select id="GetPageFTradeSaleTypeConfigAdd_PageConfig_QiShuType" name="PageConfig_QiShuType">
        <option value="月" selected>月</option>
        <option value="季">季</option>
    </select>
</p>
<p>
    <label>每期金额：</label>
    <input id="GetPageFTradeSaleTypeConfigAdd_PageConfig_JinE" name="PageConfig_JinE" class="required inputFloat" type="text" value="0" size="" alt="" />
    <span class="unit">元</span>
</p>
<div class="divider">
</div>
<div id="Page_AutoFenQiCon">
    &nbsp;&nbsp;&nbsp;&nbsp;填写以上1,2两条参数,将自动生成分期信息
    <%--自动根据以上参数自动生成分期信息--%>
</div>
<script type="text/javascript">
    function addAutoFenQiCon() {
        $("#Page_AutoFenQiCon").empty();
        //1.期数
        var qishu = parseInt($("#GetPageFTradeSaleTypeConfigAdd_PageConfig_QiShu").val());
        //2.每期金额
        var JinE = $("#GetPageFTradeSaleTypeConfigAdd_PageConfig_JinE").val();
        //3.起始日期
        var lastDaoQiRi = $("#GetPageFTradeSaleTypeConfigAdd_PageConfig_DaoQiRi").val();
        //4.期数按月或按季
        var QiShuType = $("#GetPageFTradeSaleTypeConfigAdd_PageConfig_QiShuType").val();
        var htmltag = "<p>" +
		                        "   <label><b>分期-标记</b> 金额：</label>" +
		                        "   <input name='Page_JinE' class='required inputFloat' type='text' value='-金额' size='' alt='' />" +
                                "   <span class='unit'>元</span>" +
	                            "</p>" +
                                "<p>" +
		                        "    <label>到期日：</label>" +
		                        "    <input  name='Page_DaoQiRi' class='required date' type='text' value='-时间' size='' alt=''/>" +
	                            "</p>" +
                                "<input type='hidden' name='Page_ShowIndex' value='-标记' />" +
                                "<input type='hidden' name='Page_TongJiName' value='短期分期' />" +
                                "<input type='hidden' name='Page_ShowTitle' value='分期-标记' />" +
                                "<input type='hidden' name='Page_SuspendedMark' value='0' /><div style='clear:both;'></div>";
        //alert(htmltag);
        var rowCon = "";
        for (var rowIndex = 1; rowIndex <= qishu; rowIndex++) {
            //到期日处理
            var addindex = QiShuType == "月" ? 1 : 3;
            addindex = addindex * rowIndex;
            var newDate;
            $.ajax({
                type: 'get',
                url: "FTradeModel/GetPageFTradeSaleTypeConfigAdd.aspx?ajaxmethod=addmonth&addIndex=" + addindex + "&lastDaoQiRi=" + lastDaoQiRi,
                dataType: "text",
                async: false,
                cache: false,
                success: function (json) {
                    try {
                        newDate = json;
                    }
                    catch (e) {

                    }
                }
            });


            rowCon = htmltag.replace(/-标记/gi, rowIndex).replace(/-金额/gi, JinE).replace(/-时间/gi, newDate);
            $(rowCon).appendTo("#Page_AutoFenQiCon");
        }
        //表单处理
        $("#Page_AutoFenQiCon").find("input.inputFloat").inputFloat().closest("div").find("input.date").each(function () {
            var $this = $(this);
            var opts = {};
            if ($this.attr("format")) opts.pattern = $this.attr("format");
            if ($this.attr("yearstart")) opts.yearstart = $this.attr("yearstart");
            if ($this.attr("yearend")) opts.yearend = $this.attr("yearend");
            $this.datepicker(opts);
        })

    }
    //addAutoFenQiCon();
    $(document).ready(function () {
        $("#GetPageFTradeSaleTypeConfigAdd_PageConfig_QiShu,#GetPageFTradeSaleTypeConfigAdd_PageConfig_JinE,#GetPageFTradeSaleTypeConfigAdd_PageConfig_DaoQiRi,#GetPageFTradeSaleTypeConfigAdd_PageConfig_QiShuType").change(function () {

            addAutoFenQiCon();
        })
    });
               
</script>
<div style="clear: both; margin-bottom: 5px;">
</div>
<%} %>

<%if (XiaoShouLeiXing == "置换")
  {%>
<p>
    <label>置换金额：</label>
    <input name="Page_JinE" class="required inputFloat" type="text" value="0" size="" alt="" />
    <span class="unit">元</span>
</p>
<p>
    <label>到期日：</label>
    <input name="Page_DaoQiRi" class="required date" type="text" value="" size="" alt="" />
</p>
<input type="hidden" name="Page_ShowIndex" value="1" />
<input type="hidden" name="Page_TongJiName" value="置换分期" />
<input type="hidden" name="Page_ShowTitle" value="置换金额" />
<input type="hidden" name="Page_SuspendedMark" value="0" />
<div class="divider"></div>
<p>
    <label>其余款项(1)：</label>
    <input name="Page_JinE" class="required inputFloat" type="text" value="0" size="" alt="" />
    <span class="unit">元</span>
</p>
<p>
    <label>到期日(1)：</label>
    <input name="Page_DaoQiRi" class="required date" type="text" value="" size="" alt="" />
</p>
<input type="hidden" name="Page_ShowIndex" value="2" />
<input type="hidden" name="Page_TongJiName" value="置换分期" />
<input type="hidden" name="Page_ShowTitle" value="其余款项" />
<input type="hidden" name="Page_SuspendedMark" value="0" />
<div class="divider"></div>
<p>
    <label>其余款项(2)：</label>
    <input name="Page_JinE" class="required inputFloat" type="text" value="0" size="" alt="" />
    <span class="unit">元</span>
</p>
<p>
    <label>到期日(2)：</label>
    <input name="Page_DaoQiRi" class="required date" type="text" value="" size="" alt="" />
</p>
<input type="hidden" name="Page_ShowIndex" value="3" />
<input type="hidden" name="Page_TongJiName" value="置换分期" />
<input type="hidden" name="Page_ShowTitle" value="其余款项" />
<input type="hidden" name="Page_SuspendedMark" value="0" />
<div class="divider"></div>
<p>
    <label>其余款项(3)：</label>
    <input name="Page_JinE" class="required inputFloat" type="text" value="0" size="" alt="" />
    <span class="unit">元</span>
</p>
<p>
    <label>到期日(3)：</label>
    <input name="Page_DaoQiRi" class="required date" type="text" value="" size="" alt="" />
</p>
<input type="hidden" name="Page_ShowIndex" value="4" />
<input type="hidden" name="Page_TongJiName" value="置换分期" />
<input type="hidden" name="Page_ShowTitle" value="其余款项" />
<input type="hidden" name="Page_SuspendedMark" value="0" />
<div style="clear: both; margin-bottom: 5px;"></div>
<%} %>